import request from '@/utils/request'
import formurlencoded from 'form-urlencoded'

//获取商家分销列表
export function fetchSalescaleList(query) {
  return request({
    url: '/admin/sale/salescale/list',
    method: 'get',
    params: query
  })
}
//停用商家分销
export function freezeSellerSale(data) {
  return request({
    url: '/admin/sale/salescale/freeze',
    method: 'post',
    data: formurlencoded(data)
  })
}
//启用商家分销
export function unfreezeSellerSale(data) {
  return request({
    url: '/admin/sale/salescale/unfreeze',
    method: 'post',
    data: formurlencoded(data)
  })
}
//跳转设置三级分销
export function toEditSalescale(query) {
  return request({
    url: '/admin/sale/salescale/edit',
    method: 'get',
    params: query
  })
}
//更新商家分销
export function updateSellerSale(data) {
  return request({
    url: '/admin/sale/salescale/update',
    method: 'post',
    data: formurlencoded(data)
  })
}
//获取分销人员信息
export function fetchSaleMemberList(query) {
  return request({
    url: '/admin/sale/salemember/list',
    method: 'get',
    params: query
  })
}

//分销人员审核通过
export function unfreezeSaleMember(data) {
  return request({
    url: '/admin/sale/salemember/unfreeze',
    method: 'post',
    data: formurlencoded(data)
  })
}
//分销人员审核驳回
export function freezeSaleMember(data) {
  return request({
    url: '/admin/sale/salemember/freeze',
    method: 'post',
    data: formurlencoded(data)
  })
}
//获取分销设置
export function salesetting() {
  return request({
    url: '/admin/sale/salesetting',
    method: 'get'
  })
}
//更新分销设置
export function updateSalesetting(data) {
  return request({
    url: '/admin/sale/salesetting/update',
    method: 'post',
    data: formurlencoded(data)
  })
}

//获取佣金流水
export function fetchSaleorderList(query) {
  return request({
    url: '/admin/sale/saleorder/list',
    method: 'get',
    params: query
  })
}
//结算中心
export function fetchSaleApplyMoneyList(query) {
  return request({
    url: '/admin/sale/saleapplymoney1/list',
    method: 'get',
    params: query
  })
}
//打款
export function updatemoneystate(data) {
  return request({
    url: '/admin/sale/saleapplymoney1/updatemoneystate',
    method: 'post',
    data: formurlencoded(data)
  })
}
